from django.db import models
from training.users.models import Teacher
from training.organizations.models import Organization
from django.utils.translation import ugettext_lazy as _
import logging

logger = logging.getLogger(__name__)

# Create your models here.
class Category(models.Model):
    name = models.CharField(_("name"), max_length = 300)
    description = models.TextField(_("description"))
    
    class Meta:
        verbose_name = _("category")
        verbose_name_plural = _("categories")

class CourseType(models.Model):
    name = models.CharField(_("name"), max_length = 300)
    description = models.TextField(_("description"))
    organization = models.ForeignKey(Organization, verbose_name=_("organization"))
    category = models.ForeignKey(Category, verbose_name = _("category"))
    
    def __unicode__(self):
        return '%s' % self.name
    class Meta:
        verbose_name = _("courseType")
        verbose_name_plural = _("courseTypes")
    
class Course(models.Model):
    startTime = models.DateTimeField()
    endTime = models.DateTimeField()
    capacity = models.IntegerField(_("capacity"))
    type = models.ForeignKey(CourseType, verbose_name=_("type"))
    teacher = models.ForeignKey(Teacher, verbose_name=_("teacher"))
    organization = models.ForeignKey(Organization, verbose_name=_("organization"))
    def __unicode__(self):
        return '%s' % self.type
    
    class Meta:
        verbose_name = _("course")
        verbose_name_plural = _("courses")
